package kliment.flex.mx.controls {
	import mx.controls.Label;

	public class LabelExt extends Label {
		private var _enabled:Boolean = true;

		public function LabelExt() {
			super();
		}

		override public function set data(value:Object):void {
			if (value != null && ((value is XML && value.@enabled == 'false') || value.enabled==false || value.enabled=='false'))
				_enabled = false;
			else 
				_enabled = true;

			super.data = value;
		}

		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { 
			super.updateDisplayList(unscaledWidth, unscaledHeight);

			if (!_enabled) 
				textField.setColor(getStyle("disabledColor"));
			else 
				textField.setColor(getStyle("color"));
		}
	}
}
